<link rel="stylesheet" href="views/register/register.css">
<div class="form-div">
<h1 class="am-u-sm-12">注册</h1>
<form class="am-form am-form-horizontal registerForm" name="registerForm" ng-submit="register()">
    <div class="am-form-group"
         ng-class="{true:'am-form-error'}[
         registerForm.email.$invalid && registerForm.email.$dirty
         ]">
        <label for="email" class="am-u-sm-3 am-form-label">电子邮件</label>
        <div class="am-u-sm-9">
            <input required email-unique type="email" name="email" ng-model="user.email" class="am-form-field"
                   id="email" placeholder="输入你的电子邮件">
        </div>
        <div class="am-u-sm-offset-3 am-u-sm-9 am-text am-text-danger"
             ng-show="registerForm.email.$dirty && registerForm.email.$invalid">
            <span ng-show="registerForm.email.$error.required">邮箱不能为空</span>
            <span ng-show="registerForm.email.$error.email">邮箱格式不正确</span>
            <span ng-show="registerForm.email.$error.exists">该邮箱已经注册</span>
        </div>

    </div>

    <div class="am-form-group"
         ng-class="{true:'am-form-error'}[registerForm.password.$invalid && registerForm.password.$dirty ]">
        <label for="password" class="am-u-sm-3 am-form-label">密码</label>
        <div class="am-u-sm-9">
            <input required type="password" name="password" ng-minlength="6" ng-maxlength="10"
                   ng-model="user.password"
                   class="am-form-field" id="password" placeholder="设置一个密码吧">
        </div>
        <div class="am-u-sm-offset-3 am-u-sm-9 am-text am-text-danger"
             ng-show="registerForm.password.$dirty && registerForm.password.$invalid">
            <span ng-show="registerForm.password.$error.required">密码不能为空</span>
            <span ng-show="registerForm.password.$error.minlength">密码为6-10位，当前不足6位</span>
            <span ng-show="registerForm.password.$error.maxlength">密码为6-10位，当前超过10位</span>
        </div>
    </div>
    <div class="am-form-group"
         ng-class="{true:'am-form-error'}[registerForm.password.$invalid && registerForm.password.$dirty ]">
        <label for="password" class="am-u-sm-3 am-form-label">重复密码</label>
        <div class="am-u-sm-9">
            <input required type="password" name="confirmPassword" ng-minlength="6" ng-maxlength="10"
                   ng-model="user.confirmPassword"
                   class="am-form-field" id="confirmPassword" placeholder="再确认下密码吧">
        </div>
        <div class="am-u-sm-offset-3 am-u-sm-9 am-text am-text-danger"
             ng-show="registerForm.confirmPassword.$dirty && registerForm.password.$invalid">
            <span ng-show="registerForm.confirmPassword.$error.required">密码不能为空</span>
            <span ng-show="registerForm.confirmPassword.$error.minlength">密码为6-10位，当前不足6位</span>
            <span ng-show="registerForm.confirmPassword.$error.maxlength">密码为6-10位，当前超过10位</span>
        </div>
        <div class="am-u-sm-offset-3 am-u-sm-9 am-text am-text-danger"
             ng-show="user.password!=user.confirmPassword && registerForm.confirmPassword.$dirty">
            <span>两次输入的密码必须一致</span>
        </div>
    </div>

    <div class="am-form-group">
        <div class="am-u-sm-10 am-u-sm-offset-2">
            <button type="submit" ng-disabled="registerForm.$invalid || ( user.password!=user.confirmPassword) " class="am-btn am-btn-primary am-u-sm-10">登录
            </button>
        </div>
        <div class="am-u-sm-offset-2 am-u-sm-10 am-text am-text-danger"
             ng-show="erroMsg.result==0">
            <span ng-bind="erroMsg.msg"></span>
        </div>
    </div>
</form>
</div>